<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('费用项信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>费用项ID：</label>
                                <input type="text" placeholder="请输入费用项ID" name="expenseId"/>
                            </li>
                            <li>
                                <label>收费项目：</label>
                                <input type="text" placeholder="请输入费用项目" name="payItems"/>
                            </li>
                            <li>
                                <label>付费类型：</label>
                                <select name="paymentType">
                                    <option value="">请选择付费类型</option>
                                    <option value="0">预付费</option>
                                    <option value="1">后付费</option>
                                </select>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="property:expenseItemInfo:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="property:expenseItemInfo:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="property:expenseItemInfo:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="property:expenseItemInfo:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('property:expenseItemInfo:edit')}]];
        var discountFlag = [[${@permission.hasPermi('property:expenseItemInfo:discount')}]];
        var removeFlag = [[${@permission.hasPermi('property:expenseItemInfo:remove')}]];
        var prefix = ctx + "property/expenseItemInfo";

        function feeDiscountConfig(expenseId) {
            var url = ctx + '/property/feeDiscountConfig/{expenseId}';
            $.modal.open("费用折扣", url);
        }

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "费用项信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'expenseId',
                    title: '费用项ID'
                },
                {
                    field: 'expenseType',
                    title: '费用类型',
                    formatter: function(value, row, index) {
                        if(value=="1"){
                            return "物业费";
                        }else if(value=="2"){
                            return "电费";
                        }else if(value=="3"){
                            return "水费";
                        }else if(value=="4"){
                            return "停车费";
                        }else if(value=="5"){
                            return "空调费";
                        }else if(value=="6"){
                            return "租金";
                        }else {
                            return "其他";
                        }
                    }
                },
                {
                    field: 'payItems',
                    title: '收费项目'
                },
                {
                    field: 'feeFlag',
                    title: '费用标识',
                    formatter: function(value, row, index) {
                        if(value=="0"){
                            return "周期性费用";
                        }else {
                            return "一次性费用";
                        }
                    }
                },
                {
                    field: 'billType',
                    title: '催缴类型',
                    formatter: function(value, row, index) {
                        if(value=="0"){
                            return "每年一月一日";
                        }else if(value=="1"){
                            return "每月一日";
                        }else {
                            return "每日";
                        }
                    }

                },
                {
                    field: 'paymentType',
                    title: '付费类型',
                    formatter: function(value, row, index) {
                        if(value=="0"){
                            return "预付费";
                        }else {
                            return "后付费";
                        }
                    }
                },
                {
                    field: 'paymentCycle',
                    title: '缴费周期(单位:月)'
                },
                {
                    field: 'startTime',
                    title: '计费起始时间'
                },
                {
                    field: 'endTime',
                    title: '计费终止时间'
                },
                {
                    field: 'squarePrice',
                    title: '计费单价(单位:元)'
                },
                {
                    field: 'additionalAmount',
                    title: '附加/固定费用(单位:元)'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.expenseId + '\')"><i class="fa fa-edit"></i>修改</a> ');
                        actions.push('<a class="btn btn-primary btn-xs " href="javascript:void(0)" onclick="feeDiscountConfig(row.expenseId)"><i class="fa fa-ticket"></i>折扣</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.expenseId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };

            $.table.init(options);
        });


    </script>
</body>
</html>